public class Test {

    public static void main(String[] args) {
        funAddStr();
        funFormatStr();
    }

    private static void funFormatStr() {
        long start = System.currentTimeMillis();
        String res = String.format("%s: Good %s, world!", getName(), getWords());
        long cost = System.currentTimeMillis() - start;
        System.out.println("FormatStr: " + res + "\ncost time " + cost);
    }

    private static void funAddStr() {
        long start = System.currentTimeMillis();
        String res = getName() + ": Good " + getWords() + ", world!";
        long cost = System.currentTimeMillis() - start;
        System.out.println("AddStr: " + res + "\ncost time " + cost);
    }

    private static String getWords() {
        return "morning";
    }

    private static String getName() {
        return "Jim";
    }


}
